styleproperty: make background-clip and background-area array properties
authorCosimo Cecchi <cosimoc@gnome.org>
Thu, 10 May 2012 14:25:33 +0000 (10:25 -0400)
committerCosimo Cecchi <cosimoc@gnome.org>
Tue, 15 May 2012 17:24:40 +0000 (13:24 -0400)
Right now just make them arrays, but don't consider values after the
first.

gtk/gtkcssstylepropertyimpl.c
gtk/gtkthemingbackground.c

index 0a642f0065e2018f7a1bef255c775f840311e10e..cde6ee51170595ed7b537a46204241ffdcace06d 100644 (file)
@@ -412,8 +412,7 @@ assign_border_style (GtkCssStyleProperty *property,
 }
 
 static GtkCssValue *
-parse_css_area (GtkCssStyleProperty *property,
-                GtkCssParser        *parser)
+parse_css_area_one (GtkCssParser *parser)
 {
   GtkCssValue *value = _gtk_css_area_value_try_parse (parser);
   
@@ -423,6 +422,13 @@ parse_css_area (GtkCssStyleProperty *property,
   return value;
 }
 
+static GtkCssValue *
+parse_css_area (GtkCssStyleProperty *property,
+                GtkCssParser        *parser)
+{
+  return _gtk_css_array_value_parse (parser, parse_css_area_one, FALSE);
+}
+
 static GtkCssValue *
 bindings_value_parse_one (GtkCssParser *parser)
 {
@@ -1253,7 +1259,7 @@ _gtk_css_style_property_init_properties (void)
                                           NULL,
                                           NULL,
                                           NULL,
-                                          _gtk_css_area_value_new (GTK_CSS_AREA_BORDER_BOX));
+                                          _gtk_css_array_value_new (_gtk_css_area_value_new (GTK_CSS_AREA_BORDER_BOX)));
   gtk_css_style_property_register        ("background-origin",
                                           GTK_CSS_PROPERTY_BACKGROUND_ORIGIN,
                                           G_TYPE_NONE,
@@ -1263,7 +1269,7 @@ _gtk_css_style_property_init_properties (void)
                                           NULL,
                                           NULL,
                                           NULL,
-                                          _gtk_css_area_value_new (GTK_CSS_AREA_PADDING_BOX));
+                                          _gtk_css_array_value_new (_gtk_css_area_value_new (GTK_CSS_AREA_PADDING_BOX)));
   gtk_css_style_property_register        ("background-size",
                                           GTK_CSS_PROPERTY_BACKGROUND_SIZE,
                                           G_TYPE_NONE,
index 158ac32f7e2dd0f5b1b1d65f81c71d704d75cf54..4c7e44bbfc4ec3aa272518a7d13bfc21a44f0145 100644 (file)
@@ -57,10 +57,9 @@ _gtk_theming_background_apply_window_background (GtkThemingBackground *bg,
 static void
 _gtk_theming_background_apply_origin (GtkThemingBackground *bg)
 {
-  GtkCssArea origin;
   cairo_rectangle_t image_rect;
-
-  origin = _gtk_css_area_value_get (_gtk_style_context_peek_property (bg->context, GTK_CSS_PROPERTY_BACKGROUND_ORIGIN));
+  GtkCssValue *value = _gtk_style_context_peek_property (bg->context, GTK_CSS_PROPERTY_BACKGROUND_ORIGIN);
+  GtkCssArea origin = _gtk_css_area_value_get (_gtk_css_array_value_get_nth (value, 0));
 
   /* The default size of the background image depends on the
      background-origin value as this affects the top left
@@ -95,7 +94,8 @@ _gtk_theming_background_apply_origin (GtkThemingBackground *bg)
 static void
 _gtk_theming_background_apply_clip (GtkThemingBackground *bg)
 {
-  GtkCssArea clip = _gtk_css_area_value_get (_gtk_style_context_peek_property (bg->context, GTK_CSS_PROPERTY_BACKGROUND_CLIP));
+  GtkCssValue *value = _gtk_style_context_peek_property (bg->context, GTK_CSS_PROPERTY_BACKGROUND_CLIP);
+  GtkCssArea clip = _gtk_css_area_value_get (_gtk_css_array_value_get_nth (value, 0));
 
   if (clip == GTK_CSS_AREA_PADDING_BOX)
     {